﻿package com.dg.gaming.api.common.msg
{
	import nanoxml.*;

	/**
	 * <p>Title: </p>
	 *
	 * <p>Description: </p>
	 *
	 * <p>Copyright: Copyright (c) 2009</p>
	 *
	 * <p>Company: </p>
	 *
	 * @author not attributable
	 * @version 1.0
	 */
	public class MsgConnectTable extends MsgTableMessage
	{
		private var gameID:Number=-1;

		protected static const XML_ATT_GAME_ID:String="gameID";

		public function MsgConnectTable(tableNum:Number=-1, userid:Number=-1, gameID:Number=-1, message:XMLElement=null)
		{

			initUserId(userid);

			setTableNum("" + tableNum);

			this.gameID=gameID;

			if (message != null)
			{
				super(message);
				this.gameID=message.getLongAttribute(XML_ATT_GAME_ID, -1);
			}
		}


		public override function flatten():XMLElement
		{
			var message:XMLElement=super.flattenWithName(Msg.CONNECT_TABLE);
			if (gameID != -1)
			{
				message.setLongAttribute(XML_ATT_GAME_ID, gameID);
			}
			return message;
		}

		public function getGameID():Number
		{
			return gameID;
		}
	}
}